package net.maku.events.service.impl;

import cn.hutool.core.bean.BeanUtil;
import lombok.AllArgsConstructor;
import net.maku.framework.mybatis.service.impl.BaseServiceImpl;
import net.maku.events.entity.ActivityContestQuestionOptionEntity;
import net.maku.events.vo.ActivityContestQuestionOptionVO;
import net.maku.events.dao.ActivityContestQuestionOptionDao;
import net.maku.events.service.ActivityContestQuestionOptionService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 竞赛答题选项
 *
 * @author 阿沐 babamu@126.com
 * @since 1.0.0 2025-03-22
 */
@Service
@AllArgsConstructor
public class ActivityContestQuestionOptionServiceImpl extends BaseServiceImpl<ActivityContestQuestionOptionDao, ActivityContestQuestionOptionEntity> implements ActivityContestQuestionOptionService {


    @Override
    public void save(Long contestQuestionId, List<ActivityContestQuestionOptionVO> voList) {
        List<ActivityContestQuestionOptionEntity> entityList = BeanUtil.copyToList(voList, ActivityContestQuestionOptionEntity.class);
        entityList.forEach(item -> item.setContestQuestionId(contestQuestionId));
        this.saveBatch(entityList);
    }
}